/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package main.social.entities;

import java.io.Serializable;
import java.util.Date;
import java.util.List;
import javax.persistence.*;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author user
 */
@Entity
@Table(name = "jobs")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Jobs.findAll", query = "SELECT j FROM Jobs j"),
    @NamedQuery(name = "Jobs.findById", query = "SELECT j FROM Jobs j WHERE j.id = :id"),
    @NamedQuery(name = "Jobs.findByName", query = "SELECT j FROM Jobs j WHERE j.name = :name"),
    @NamedQuery(name = "Jobs.findByStart", query = "SELECT j FROM Jobs j WHERE j.start = :start"),
    @NamedQuery(name = "Jobs.findByEnd", query = "SELECT j FROM Jobs j WHERE j.end = :end"),
    @NamedQuery(name = "Jobs.findByPosition", query = "SELECT j FROM Jobs j WHERE j.position = :position")})
public class Jobs implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "id")
    private Long id;
    @Basic(optional = false)
    @Column(name = "name", nullable = false, length = 200)
    private String name;
    @Column(name = "start")
    @Temporal(TemporalType.DATE)
    private Date start;
    @Column(name = "end")
    @Temporal(TemporalType.DATE)
    private Date end;
    @Column(name = "position", length =100)
    private String position;
    @ManyToMany(mappedBy = "jobsList")
    private List<Users> usersList;
    @JoinColumn(name = "Address_id1", referencedColumnName = "id")
    @ManyToOne
    private Address addressid1;

    public Jobs() {
    }

    public Jobs(Long id) {
        this.id = id;
    }

    public Jobs(Long id, String name) {
        this.id = id;
        this.name = name;
    }

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public Date getStart() {
        return start;
    }

    public void setStart(Date start) {
        this.start = start;
    }

    public Date getEnd() {
        return end;
    }

    public void setEnd(Date end) {
        this.end = end;
    }

    public String getPosition() {
        return position;
    }

    public void setPosition(String position) {
        this.position = position;
    }

    @XmlTransient
    public List<Users> getUsersList() {
        return usersList;
    }

    public void setUsersList(List<Users> usersList) {
        this.usersList = usersList;
    }

    public Address getAddressid1() {
        return addressid1;
    }

    public void setAddressid1(Address addressid1) {
        this.addressid1 = addressid1;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Jobs)) {
            return false;
        }
        Jobs other = (Jobs) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "main.social.entity.Jobs[ id=" + id + " ]";
    }
    
}
